﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>全部</title>
    <link href="@Url.Content("~/Areas/User/Css/index.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Areas/User/Css/msg.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/JS/artDialog/skins/qhwDialog.css")/Script/artDialog/skins/qhwDialog.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
     <form id="form1">
    <!--右侧开始-->
    <div class="rightbar mt10">
        <ul class="tittab">
            <li class="tcurrent">全部</li>
        </ul>
        <uc2:MsgContent ID="MsgContent" runat="server"></uc2:MsgContent>
        <div class="msginquiry">
            <asp:Repeater ID="Rpt_DetailList" runat="server">
                <ItemTemplate>
                    <dl class="other">
                        <uc2:MsgContent ID="MsgDetailList" MailId='<%#Eval("Id")%>' Type='<%#Eval("TypeId") %>'
                            runat="server"></uc2:MsgContent>
                    </dl>
                </ItemTemplate>
            </asp:Repeater>
            <%if (SenderCname != "")
              {%>
            <div class="msgtextarea">
                <span class="f14"><b>发送给：</b><%=SenderCname %></span>
                <textarea id='txtReply' class=""></textarea>
                <a hidefocus="" href="####" onclick="ReplyMessage(<%=MailId %>,<%=UserId %>,<%=RId %>)"
                    class="save-btn fd-left">确 定 </a>
            </div>
            <%
                }%>
        </div>
    </div>
    </form>
     <script src="@Url.Content("~/JS/artDialog/artDialog.source.js?skin=simple")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/artDialog/dialogHelper.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            getNoReadCount();
        });

        function getNoReadCount() {
            $.ajax({
                type: "POST",
                url: "/CommonAshx/WebMessageWarn.ashx?callback=?",
                dataType: "json",
                //回调函数返回未读短信数目
                success: function (response) {
                    $('#yjMsgCount').html("(" + response.YjCount + ")");
                    $('#bjMsgCount').html("(" + response.BjCount + ")");
                    $('#webMsgCount').html("(" + response.WebCount + ")");
                    $('#userMsgCount').html("(" + response.UserCount + ")");
                },
                error: function (data) {
                    //                    alert("加载失败");
                }
            });
            window.setTimeout(getNoReadCount, 30000);
        }


        function ReplyMessage(mid, sid, rid) {
            if ($("#txtReply").val() == "") {
                jQuery.dialogHelper.alert("请输入回复内容！", "alert");
            }
            else {
                $.ajax({
                    type: "POST",
                    url: "/CommonASHX/WebMessageReply.ashx",
                    dataType: "text",
                    data: "mid=" + mid + "&sid=" + sid + "&rid=" + rid + "&contents=" + $("#txtReply").val(),
                    //回调函数返回未读短信数目
                    success: function (msg) {
                        var state = "warning";
                        if (msg.indexOf("传参有误") != -1) {
                            jQuery.dialogHelper.alert("传参有误！", "alert");
                        } else if (msg.indexOf("操作失败") != -1) {
                            jQuery.dialogHelper.alert("操作失败！", "alert");
                        } else {
                            jQuery.dialogHelper.alert("发送成功", "success", "ok");
                        }
                        setTimeout("location.href = window.location;", 2000);
                    },
                    error: function () {
                        jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");

                    }
                });
                window.setTimeout(getNoReadCount, 30000);
            }
        }

        //执行成功后刷新页面
        function ok() {
            location.href = "/Message/WebMsgDetail.aspx?type=<%=type %>&id=<%=id %>";
            $.dialogHelper.close();
        }

                   

    </script>
</body>
</html>
